﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace AnesSystem.Controls
{
    /// <summary>
    /// CusDatePickerWin.xaml 的交互逻辑
    /// </summary>
    public partial class CusDatePickerWin : Window
    {

        #region Variables

        #endregion

        #region Constructor

        public CusDatePickerWin()
        {
            InitializeComponent();
            this.Loaded += CusDatePickerWin_Loaded;
        }

        private void CusDatePickerWin_Loaded(object sender, RoutedEventArgs e)
        {
            _cusDatePicker.DateSelected += CusDatePicker_DateSelected;
        }

        #endregion

        #region Properties

        public bool Result { get; set; }

        #endregion

        #region 依赖属性

        public DateTime SelectedDateTime
        {
            get { return (DateTime)GetValue(SelectedDateTimeProperty); }
            set { SetValue(SelectedDateTimeProperty, value); }
        }

        // Using a DependencyProperty as the backing store for SelectedDateTime.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty SelectedDateTimeProperty =
            DependencyProperty.Register("SelectedDateTime", typeof(DateTime), typeof(CusDatePickerWin), new PropertyMetadata());

        #endregion

        #region Event

        #endregion

        #region Private Methods

        #endregion

        #region Public/Protected Methods

        #endregion

        #region EventHandlers

        private void CusDatePicker_DateSelected(object sender, EventArgs e)
        {
            Result = _cusDatePicker.Result;
            this.Close();
        }

        #endregion
    }
}
